package com.ledtechdesign.beans.api.pojo;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import com.ledtechdesign.beans.api.INode;

public class AFCSNode implements INode {

	public String href;// href="/accounts/bkf/lalala/meetings"
	public String name;
	public Map<String, Object> properties;

	public String type;// cr:folder

	public AFCSNode() {
		super();
		this.properties = new HashMap<String, Object>();
	}

	public void addProperty(String key, Object value) {
		this.properties.put(key, value);
	}

	public String getHref() {
		return this.href;
	}

	public String getName() {
		return this.name;
	}

	public Map<String, Object> getProperties() {
		return this.properties;
	}

	public Object getProperty(String key) {
		return this.properties.get(key);
	}

	public String getType() {
		return this.type;
	}

	public void print() {
		System.out.println(this.toString());
	}

	public void setHref(String href) {
		this.href = href;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		StringBuffer sb = new StringBuffer();
		sb.append("---Node name#" + this.name);
		sb.append("\n\r");
		sb.append("---Node href#" + this.href);
		sb.append("\n\r");
		sb.append("---Node type#" + this.type);
		sb.append("\n\r");
		sb.append("---Properties ------");
		sb.append("\n\r");
		Iterator<Map.Entry<String, Object>> it = this.getProperties()
				.entrySet().iterator();
		while (it.hasNext()) {
			Map.Entry<String, Object> pairs = it.next();
			sb.append("----" + pairs.getKey() + " = " + pairs.getValue());
			sb.append("\n\r");
		}
		sb.append("---End of Properties ------");
		sb.append("\n\r");
		return sb.toString();
	}

}
